<!--
 * @Descripttion:安装设备列表
 * @version: 
 * @Author: gonghong
 * @Date: 2023-07-07 09:31:41
-->
<script setup>
import { computed } from 'vue'
import { toPageAuth } from '@/common/utils'
const props = defineProps({
  item: {
    type: Object,
    default: () => {
      return {}
    }
  },
  status: {
    type: [String, Number],
    default: ''
  }
})
/**
 * @name 跳转安装设备页面
 * @return {*}
 */
const installOnClick = () => {
  toPageAuth(`/homePages/maintenance/index`, (res) => {
    res.eventChannel.emit('getData', props.item)
  })
}

// '当前告警', '历史告警', '故障列表' => 0,1,2
const isBreakdown = computed(() => Number(props.status) === 2)
const isAlarm = computed(() => Number(props.status) === 0)
</script>
<template>
  <uni-card>
    <view class="listCard">
      <cell class="f-df f-jc-b">
        <text>设备名称:</text>
        <text>{{ item.deviceName || '无' }}</text>
      </cell>
      <cell class="f-df f-jc-b">
        <text>用户名称:</text>
        <text>{{ item.userName || '无' }}</text>
      </cell>
      <cell class="f-df f-jc-b" v-if="!isBreakdown">
        <text>告警名称:</text>
        <text>{{ item.alarmTypeName || '无' }}</text>
      </cell>
      <cell class="f-df f-jc-b" v-if="isBreakdown">
        <text>故障名称:</text>
        <text>{{ item.faultTypeName || '无' }}</text>
      </cell>
      <cell class="f-df f-jc-b">
        <text>告警时间:</text>
        <text>{{ item.createTime || '无' }}</text>
      </cell>
    </view>
  </uni-card>
</template>

<style lang="scss" scoped>
.listCard {
  display: flex;
  flex-direction: column;
}

.btn-box {
  display: flex;
  justify-content: flex-end;
  margin-top: 24upx;
}
</style>
